<%@LANGUAGE="VBSCRIPT"%>
<SCRIPT RUNAT=SERVER LANGUAGE=VBSCRIPT>					
function DoDateTime(str, nNamedFormat, nLCID)				
	dim strRet								
	dim nOldLCID								
										
	strRet = str								
	If (nLCID > -1) Then							
		oldLCID = Session.LCID						
	End If									
										
	On Error Resume Next							
										
	If (nLCID > -1) Then							
		Session.LCID = nLCID						
	End If									
										
	If ((nLCID < 0) Or (Session.LCID = nLCID)) Then				
		strRet = FormatDateTime(str, nNamedFormat)			
	End If									
										
	If (nLCID > -1) Then							
		Session.LCID = oldLCID						
	End If									
										
	DoDateTime = strRet							
End Function									
</SCRIPT>

 
<!--#include file="functions.asp" -->
<% 

dim sql

sql = "UPDATE EXIREG SET "
sql = sql & " ISOPEN='Y'" 
sql = sql & " WHERE SEQNUM=" & request.querystring("seqnum")

   dim tmpSQL
   if (request.querystring("InvStatus") <> "0") then
   tmpSQL=" AND INVSTATUS='"& request.querystring("InvStatus") & "'"
   'else
   'tmpSQL=" AND (INVSTATUS = 'PARKED' OR INVSTATUS = 'ROUTED' OR INVSTATUS = 'PREAPPROVED' OR INVSTATUS = 'APPROVED')"
   end if
   
   if (request.querystring("CurSymbol") <> "N") then
   tmpSQL= tmpSQL & " AND CURRENCYSYMBOL='"& request.querystring("CurSymbol") & "'"
   end if
   
   
   if (request.querystring("Location") <> "") then
   tmpSQL= tmpSQL & " AND LOCATION='"& request.querystring("location") & "'"
   end if
   
   if (request.querystring("UserCoord") <> "") then
   tmpSQL= tmpSQL & " AND USERCOORD='"& request.querystring("UserCoord") & "'"
   end if
   
   if (request.querystring("VendorID") <> "") then
   tmpSQL= tmpSQL & " AND VENDORID='"& request.querystring("VendorID") & "'"
   end if
   
   if (request.querystring("RefOrder") <> "0") then
   tmpSQL= tmpSQL & " AND REFORDER='"& request.querystring("RefOrder") & "'"
   end if
   
   dim tmpSort
   tmpSort="INVRECDATE"
   if (request.querystring("dSort") <> "") then
   tmpSort= request.querystring("dSort")
   end if
   
   dim tmpOrder
   tmpOrder = "ASC"
   if (request.QueryString("dOrder") <>"") then
   tmpOrder= request.QueryString("dOrder")
   end if
   Dim CurrOrder
   if (tmpOrder = "ASC" )then 
   CurrOrder ="DESC"
   else
   CurrOrder="ASC"
   end if
   
%>
<%
set CompCode = Server.CreateObject("ADODB.Recordset")
CompCode.ActiveConnection = cn
CompCode.Source = "SELECT *  FROM dbo.COMPCODE"
'CompCode.CursorType = 0
'CompCode.CursorLocation = 2
'CompCode.LockType = 3
CompCode.Open()
CompCode_numRows = 0
%>
<%
Dim EXIREG__tmpNum
EXIREG__tmpNum = "0"
if (Request.QueryString("Seqnum") <> "") then EXIREG__tmpNum = Request.QueryString("Seqnum")
%>
<%
set EXIREG = Server.CreateObject("ADODB.Recordset")
EXIREG.ActiveConnection = cn
EXIREG.Source = "SELECT SEQNUM, REGNUM, INVNUM, INVSTATUS, VENDORID, PONUM,INVRECDATE, INVDUEDATE, EMPCODE, LOCATION, DEPARTMENT, "_
& "INVCURRENCY, (SELECT EXCHANGERATE FROM EXCHRATE WHERE EXCHRATE.MP2CURRENCY=EXIREG.INVCURRENCY) AS FRATE,REFERENCEDOC,"_
& "VERIFIEDBY, VERIFIEDSTATUS, AUTHORISEDBY, APPROVEDBY,APPROVED2BY,JOINAPPROVAL,"_
& "DATEVERIFIED,DATEAUTHORISED,DATEAPPROVED,DATEAPPROVED2,MULTIVERIFY,"_
& "CURRENCYSYMBOL, INVAMOUNT, REFORDER, DOC1, DOC2, COMPCODE, VATNUM, WHTNAME, VATRATE, (SELECT LOCNAME=CASE WHEN LASTNAME IS NOT NULL THEN EMP.FIRSTNAME + ' '  + EMP.LASTNAME WHEN LASTNAME IS NULL THEN EMP.FIRSTNAME END FROM dbo.EMP WHERE EMP.EMPCODE=EXIREG.LOCATION) AS LOCNAME,"_
& "WHTRATE, WHTAMOUNT, VATPAIDTOVENDOR,   (SELECT TOP 1 VENDOR.NAME  FROM VENDOR  WHERE VENDOR.VENDORID=EXIREG.VENDORID) AS VENDORNAME,    "_
& "(SELECT EMP.FIRSTNAME + ' '  + EMP.LASTNAME FROM dbo.EMP WHERE EMP.EMPCODE=EXIREG.EMPCODE) AS EMPNAME,  "_
& "(SELECT EMP.FIRSTNAME + ' '  + EMP.LASTNAME FROM dbo.EMP WHERE EMP.EMPCODE=EXIREG.VERIFIEDBY) AS VERNAME,"_
& "(SELECT EMP.FIRSTNAME + ' '  + EMP.LASTNAME FROM dbo.EMP WHERE EMP.EMPCODE=EXIREG.AUTHORISEDBY) AS AUTHNAME,"_
& "(SELECT EMP.FIRSTNAME + ' '  + EMP.LASTNAME FROM dbo.EMP WHERE EMP.EMPCODE=EXIREG.APPROVEDBY) AS APPRNAME,"_
& "(SELECT EMP.FIRSTNAME + ' '  + EMP.LASTNAME FROM dbo.EMP WHERE EMP.EMPCODE=EXIREG.APPROVED2BY) AS APPRNAME2,"_
& "COMMENTS  FROM dbo.EXIREG  WHERE  SEQNUM=" + Replace(EXIREG__tmpNum, "'", "''") + " " 
'EXIREG.CursorType = 0
'EXIREG.CursorLocation = 2
'EXIREG.LockType = 3
EXIREG.Open()
EXIREG_numRows = 0
%>
<% 
'Dim InvSeqnum
'InvSeqnum = EXIREG.Fields.Item("SEQNUM").Value
%>
<%
Dim InvHist__tmpNum
InvHist__tmpNum = "0"
if (Request.QueryString("seqnum") <> "") then InvHist__tmpNum = Request.QueryString("seqnum")

%>
<%
'sql = sql & "(SELECT LOCNAME=CASE WHEN LASTNAME IS NOT NULL THEN EMP.FIRSTNAME + ' '  + EMP.LASTNAME "
'sql = sql & " WHEN LASTNAME IS NULL THEN EMP.FIRSTNAME END "
'sql = sql & " FROM dbo.EMP WHERE EMP.EMPCODE=EXIHIST.LOCATION) AS LOCNAME "
set InvHist = Server.CreateObject("ADODB.Recordset")
InvHist.ActiveConnection = cn
'if (request.querystring("Seqnum") <> "0") then
InvHist.Source = "SELECT *,  (SELECT TRDESCR FROM EXITRTYPE WHERE EXIHIST.TRANSTYPE=EXITRTYPE.TRTYPE) AS TRDESCR , (SELECT LOCNAME=CASE WHEN LASTNAME IS NOT NULL THEN EMP.FIRSTNAME + ' '  + EMP.LASTNAME WHEN LASTNAME IS NULL THEN EMP.FIRSTNAME END FROM dbo.EMP WHERE EMP.EMPCODE=EXIHIST.LOCATION) AS LOCNAME   FROM dbo.EXIHIST  WHERE SEQNUM=" + Replace(InvHist__tmpNum, "'", "''") + " ORDER BY UPDATESTAMP"
'else
'InvHist.Source = "SELECT *,  (SELECT TRDESCR FROM EXITRTYPE WHERE EXIHIST.TRANSTYPE=EXITRTYPE.TRTYPE) AS TRDESCR ,   (SELECT EMP.FIRSTNAME + ' '  + EMP.LASTNAME FROM dbo.EMP WHERE EMP.EMPCODE=EXIHIST.LOCATION) AS LOCNAME  FROM dbo.EXIHIST  WHERE SEQNUM=" + Replace(InvSeqnum, "'", "''") + ""
'end if
'InvHist.CursorType = 0
'InvHist.CursorLocation = 2
'InvHist.LockType = 3
InvHist.Open()
InvHist_numRows = 0
%>
<%
Dim Acct__tmpNum
Acct__tmpNum = "0"
if (request.querystring("seqnum") <> "") then Acct__tmpNum = request.querystring("seqnum")
%>
<%
set Acct = Server.CreateObject("ADODB.Recordset")
Acct.ActiveConnection = cn
Acct.Source = "SELECT *  FROM dbo.EXICHARGE  WHERE INVSEQNUM=" + Replace(Acct__tmpNum, "'", "''") + ""
'Acct.CursorType = 0
'Acct.CursorLocation = 2
'Acct.LockType = 3
Acct.Open()
Acct_numRows = 0
%>
<%
Dim Repeat1__numRows
Repeat1__numRows = -1
Dim Repeat1__index
Repeat1__index = 0
InvHist_numRows = InvHist_numRows + Repeat1__numRows
%>
<%
Dim Repeat2__numRows
Repeat2__numRows = -1
Dim Repeat2__index
Repeat2__index = 0
Acct_numRows = Acct_numRows + Repeat2__numRows
%>
<%
dim isUser
dim isAuthorised
dim isOutLimit
dim TrType
dim Caption1
dim Caption2
dim Verseqnum
verseqnum=0

Function get_Authorise(e)
'if (EXIREG.Fields.Item("APPROVEDBY").Value <> "") then
 sql = "SELECT  A.GROUPDESC, A.EMPCODE, B.CURRENCY, B.INVAMTPO, B.INVAMTNONPO"
 sql = sql & " FROM dbo.EXIAUTHORITY A, dbo.EXIAUTHFINANCE B"
 sql = sql & " WHERE A.GROUPDESC=B.GROUPDESC "
 sql = sql & " AND A.EMPCODE = '" & e & "'"
 set rs = cn.execute(sql)
 
do while not rs.eof
 if (EXIREG.Fields.Item("REFORDER").Value = "Y") then
   if ((EXIREG.Fields.Item("INVAMOUNT").Value/EXIREG.Fields.Item("FRATE").Value) > rs("INVAMTPO")) then
     get_Authorise = "N"
   else
     get_Authorise = "Y"
   end if
 else
   if ((EXIREG.Fields.Item("INVAMOUNT").Value/EXIREG.Fields.Item("FRATE").Value) > rs("INVAMTNONPO")) then
     get_Authorise = "N"
   else
     get_Authorise = "Y"
   end if
 end if
 
rs.movenext
loop
set rs = nothing
'end if

end function

if (EXIREG.Fields.Item("APPROVEDBY").Value<>"")then
isAuthorised=get_Authorise(EXIREG.Fields.Item("APPROVEDBY").Value)
end if

if (EXIREG.Fields.Item("APPROVED2BY").Value<>"")then
isAuthorised=get_Authorise(EXIREG.Fields.Item("APPROVED2BY").Value)
end if


if(EXIREG.Fields.Item("JOINAPPROVAL").Value="Y") then
  caption1="Approved 1 By:"
  caption2="Approved 2 By:"
else
  caption1="Approved By:"
end if

%>
<SCRIPT Language="JavaScript">

function Valid_Charge(x,y)
{
  var dtTotal=y;
  var totalValue =  Number(document.form1.Amt1.value) + Number(document.form1.Amt2.value)+Number(document.form1.Amt3.value) +Number(document.form1.Amt4.value)+ Number(document.form1.Amt5.value);
   
   if (totalValue > dtTotal ){
     alert("Total amount is greater than invoice amount!");
     x.focus();
	 x.value=0;
     return false;
	 }
}

function DocLoad(){
var joinAppr='<%=(EXIREG.Fields.Item("JOINAPPROVAL").Value)%>';
var isAuthorised='<%= isAuthorised %>';
//document.form1.reqInvoiceNo.focus();
if (joinAppr=='N'){
  document.getElementById("Approved2").style.display='none';
  }
if (isAuthorised=='N'){
  document.getElementById("Authorise").style.display='block';
  }
else
  {
  document.getElementById("Authorise").style.display='none';
  }
}


var InvStatus='<%= request.querystring("InvStatus") %>';
var dsort='<%= request.querystring("dsort") %>';
var dorder='<%= request.querystring("dorder") %>';
var Location='<%= request.querystring("Location") %>';
var UserCoord='<%= request.querystring("UserCoord") %>';
var RefOrder='<%= request.querystring("refOrder") %>';
var VendorID='<%= request.querystring("VendorID") %>';
var CurSymbol='<%= request.querystring("CurSymbol") %>';
var RecDate='<%= request.querystring("RecDate") %>';
var RecDate2='<%= request.querystring("RecDate2") %>';
var RptCond='<%= request.querystring("RptCond") %>'

//function DocLoad(){
//document.form1.reqInvoiceNo.focus();
//}

function redirect(){
location='InvList.asp?InvStatus='+InvStatus+'&dsort='+ dsort+'&dorder='+ dorder+'&Location='+Location+'&UserCoord='+UserCoord+'&RefOrder='+RefOrder+'&VendorID='+VendorID+'&CurSymbol='+CurSymbol;
return false
}

function reroute(a,b){
var Status='<%=(EXIREG.Fields.Item("INVSTATUS").Value)%>';
if (Status=='APPROVED'){
 if (confirm('Invoice already APPROVED. Are You sure you want to reroute this invoice?')==true){
 location='Inv_Routing.asp?route='+a+ '&seqnum='+b+'&InvStatus='+InvStatus+'&dsort='+ dsort+'&dorder='+ dorder+'&Location='+Location+'&UserCoord='+UserCoord+'&RefOrder='+RefOrder+'&VendorID='+VendorID+'&CurSymbol='+CurSymbol;
 return true;
 }
 else
 return false;
}
else
location='Inv_Routing.asp?route='+a+ '&seqnum='+b+'&InvStatus='+InvStatus+'&dsort='+ dsort+'&dorder='+ dorder+'&Location='+Location+'&UserCoord='+UserCoord+'&RefOrder='+RefOrder+'&VendorID='+VendorID+'&CurSymbol='+CurSymbol;
return true
}

function register(){
location='Inv_Register.asp?InvStatus='+InvStatus+'&dsort='+ dsort+'&dorder='+ dorder+'&Location='+Location+'&UserCoord='+UserCoord+'&RefOrder='+RefOrder+'&VendorID='+VendorID+'&CurSymbol='+CurSymbol;
return false
}
</SCRIPT>
<html>
<head>
<title>Invoice Detail</title>
<link rel="stylesheet" href="CAR_style.css" type="text/css">
</head>
<body bgcolor="#FFFFFF" onLoad="DocLoad()">
<table width="100%" border="0" cellspacing="2" cellpadding="1">
  <tr> 
    <td colspan="3" valign="bottom"><b><font size="2">Invoice Detail Print Out</font></b></td>
    <td width="15%">&nbsp;</td>
    <td width="2%">&nbsp;</td>
    <td> 
      <div align="right"><img src="images/Logo_premier2.jpg" width="164" height="40"></div>
    </td>
  </tr>
  <tr> 
    <td colspan="6"><img src="images/hor_line.gif" width="100%" height="25"></td>
  </tr>
  <tr> 
    <td width="15%" bgcolor="#efefef" height="20"> 
      <div align="right"><font size="1"><b>Register No.:&nbsp;</b></font></div>
    </td>
    <td width="2%" height="20"><font size="1"></font></td>
    <td width="30%" height="20"> <font size="1"><%=(EXIREG.Fields.Item("REGNUM").Value)%> </font></td>
    <td width="15%" bgcolor="#efefef" height="20"> 
      <div align="right"><font size="1"><b>Invoice No.:&nbsp;</b></font></div>
    </td>
    <td width="2%" height="20"><font size="1"></font></td>
    <td height="20"> <font size="1"><%=(EXIREG.Fields.Item("INVNUM").Value)%> </font></td>
  </tr>
  <tr> 
    <td width="15%" bgcolor="#efefef"> 
      <div align="right"><font size="1"><b>Reference Order:&nbsp;</b></font></div>
    </td>
    <td width="2%"><font size="1"></font></td>
    <td width="30%"> <font size="1"> 
      <% if (EXIREG.Fields.Item("REFORDER").Value="Y") then %>
      <img src="images/checkbw.jpg" width="18" height="17"> 
      <% end if %>
      </font></td>
    <td width="15%" bgcolor="#efefef"> 
      <div align="right"><font size="1"><b>Current Location:&nbsp;</b></font></div>
    </td>
    <td width="2%"><font size="1"></font></td>
    <td bgcolor="#FFFFFF"><b><font color="#990000" size="1"> 
      <% if (EXIREG.Fields.Item("LOCATION").Value="FINANCE") then %>
      <font color="#000000">FINANCE</font> 
      <% else %>
      <font color="#000000"><%=(EXIREG.Fields.Item("LOCNAME").Value)%></font> 
      <% end if %>
      </font></b></td>
  </tr>
  <tr> 
    <td width="15%" bgcolor="#efefef"> 
      <div align="right"><font size="1"><b>Vendor ID:&nbsp;</b></font></div>
    </td>
    <td width="2%"><font size="1"></font></td>
    <td width="30%"> <font size="1"><%=(EXIREG.Fields.Item("VENDORID").Value)%> </font></td>
    <td width="15%" bgcolor="#efefef"> 
      <div align="right"><font size="1"><b>Status:&nbsp;</b></font></div>
    </td>
    <td width="2%"><font size="1"></font></td>
    <td bgcolor="#FFFFFF"> <font size="1"><b><%=(EXIREG.Fields.Item("INVSTATUS").Value)%></b> </font></td>
  </tr>
  <tr> 
    <td width="15%" bgcolor="#efefef"> 
      <div align="right"><font size="1"><b>Vendor Name:&nbsp;</b></font></div>
    </td>
    <td width="2%"><font size="1"></font></td>
    <td colspan="4"> <font size="1"><%=(EXIREG.Fields.Item("VENDORNAME").Value)%> </font></td>
  </tr>
  <tr> 
    <td width="15%" bgcolor="#efefef"> 
      <div align="right"><font size="1"><b>Received Date:&nbsp;</b></font></div>
    </td>
    <td width="2%"><font size="1"></font></td>
    <td width="30%"> <font size="1"><%=(EXIREG.Fields.Item("INVRECDATE").Value)%> </font></td>
    <td width="15%" bgcolor="#efefef"> 
      <div align="right"><font size="1"><b>Due Date:&nbsp;</b></font></div>
    </td>
    <td width="2%"><font size="1"></font></td>
    <td> <font size="1"><%=(EXIREG.Fields.Item("INVDUEDATE").Value)%> </font></td>
  </tr>
  <tr> 
    <td width="15%" bgcolor="#efefef"> 
      <div align="right"><font size="1"><b>Received By:&nbsp;</b></font></div>
    </td>
    <td width="2%"><font size="1"></font></td>
    <td width="30%"> <font size="1"><%=(EXIREG.Fields.Item("EMPCODE").Value)%> </font></td>
    <td width="15%" bgcolor="#efefef"> 
      <div align="right"><font size="1"><b>Department:&nbsp;</b></font></div>
    </td>
    <td width="2%"><font size="1"></font></td>
    <td> <font size="1"><%=(EXIREG.Fields.Item("DEPARTMENT").Value)%> </font></td>
  </tr>
  <tr> 
    <td width="15%" bgcolor="#efefef"><font size="1"></font></td>
    <td width="2%"><font size="1"></font></td>
    <td width="30%"> <font size="1"><%=(EXIREG.Fields.Item("EMPNAME").Value)%> </font></td>
    <td width="15%" bgcolor="#efefef"> 
      <div align="right"><font size="1"><b>PO/SO/CO No:&nbsp;</b></font></div>
    </td>
    <td width="2%"><font size="1"></font></td>
    <td> <font size="1"><%=(EXIREG.Fields.Item("PONUM").Value)%> </font></td>
  </tr>
  <tr> 
    <td width="15%" bgcolor="#efefef"> 
      <div align="right"><font size="1"><b>Currency:&nbsp;</b></font></div>
    </td>
    <td width="2%"><font size="1"></font></td>
    <td width="30%"> <font size="1"><%=(EXIREG.Fields.Item("INVCURRENCY").Value)%> </font></td>
    <td width="15%" bgcolor="#efefef"> 
      <div align="right"><font size="1"><b>Exchange Rate:&nbsp;</b></font></div>
    </td>
    <td width="2%"><font size="1"></font></td>
    <td> <font size="1"><%=(EXIREG.Fields.Item("FRATE").Value)%> </font></td>
  </tr>
  <tr> 
    <td width="15%" bgcolor="#efefef"> 
      <div align="right"><font size="1"><b>Invoice Amount:&nbsp;</b></font></div>
    </td>
    <td width="2%"><font size="1"></font></td>
    <td width="30%"> <font size="1"><%=(EXIREG.Fields.Item("CURRENCYSYMBOL").Value)%>&nbsp;&nbsp;<%= FormatNumber((EXIREG.Fields.Item("INVAMOUNT").Value), -1, -2, -2, -1) %> </font></td>
    <td width="15%" bgcolor="#efefef"> 
      <div align="right"><font size="1"><b>T0 Code:&nbsp;</b></font></div>
    </td>
    <td width="2%"><font size="1"></font></td>
    <td> <font size="1"><%= EXIREG.Fields.Item("COMPCODE").Value %> </font></td>
  </tr>
  <tr> 
    <td width="15%" bgcolor="#FFFFFF"> 
      <div align="right"><b><font size="1"></font></b></div>
    </td>
    <td width="2%"><font size="1"></font></td>
    <td width="30%"> <font size="1"> 
      <% if (EXIREG.Fields.Item("VATPAIDTOVENDOR").Value="Y") then  %>
      <img src="images/checkbw.jpg" width="18" height="17"> 
      <% else %>
      <img src="images/uncheck.jpg" width="14" height="14"> 
      <% end if %>
      VAT Paid To Vendor</font></td>
    <td width="15%"> 
      <div align="right"><font size="1"></font></div>
    </td>
    <td width="2%"><font size="1"></font></td>
    <td><b><font size="1"></font></b></td>
  </tr>
  <tr> 
    <td width="15%" bgcolor="#efefef"> 
      <div align="right"><font size="1"><b>WHT Name:&nbsp;</b></font></div>
    </td>
    <td width="2%"><font size="1"></font></td>
    <td width="30%"> <font size="1"><%=(EXIREG.Fields.Item("WHTNAME").Value)%> </font></td>
    <td width="15%" bgcolor="#efefef"> 
      <div align="right"><font size="1"><b><b>WHT Rate:</b></b></font></div>
    </td>
    <td width="2%"><font size="1"></font></td>
    <td> <font size="1"><%=(EXIREG.Fields.Item("WHTRATE").Value)%> %</font></td>
  </tr>
  <tr> 
    <td width="15%" bgcolor="#efefef"> 
      <div align="right"><font size="1"><b>VAT Rate:&nbsp;</b></font></div>
    </td>
    <td width="2%"><font size="1"></font></td>
    <td width="30%"> <font size="1"><%=(EXIREG.Fields.Item("VATRATE").Value)%> %</font></td>
    <td width="15%" bgcolor="#efefef"> 
      <div align="right"><font size="1"><b>WHT Amount:</b></font></div>
    </td>
    <td width="2%"><font size="1"></font></td>
    <td> <font size="1"><%= FormatNumber((EXIREG.Fields.Item("WHTAMOUNT").Value), -1, -2, -2, -1) %> </font></td>
  </tr>
  <tr> 
    <td width="15%" bgcolor="#FFFFFF"><font size="1"></font></td>
    <td width="2%"><font size="1"></font></td>
    <td width="30%"> <font size="1"> 
      <% if (EXIREG.Fields.Item("DOC1").Value="Y") then  %>
      <img src="images/checkbw.jpg" width="18" height="17"> 
      <% else %>
      <img src="images/uncheck.jpg" width="14" height="14"> 
      <% end if %>
      Original Invoice with Revenue Stamp</font></td>
    <td width="15%" bgcolor="#FFFFFF"><font size="1"></font></td>
    <td width="2%"><font size="1"></font></td>
    <td> <font size="1"> 
      <% if (EXIREG.Fields.Item("DOC2").Value="Y") then  %>
      <img src="images/checkbw.jpg" width="18" height="17"> 
      <% else %>
      <img src="images/uncheck.jpg" width="14" height="14"> 
      <% end if %>
      Tax Invoices (6 pages)</font></td>
  </tr>
  <tr valign="middle"> 
    <td width="15%" bgcolor="#efefef"> 
      <div align="right"><font size="1"><b>Verified By:&nbsp;</b></font></div>
    </td>
    <td width="2%"><font size="1"></font></td>
    <td colspan="4"> <font size="1"><%=(EXIREG.Fields.Item("VERIFIEDBY").Value)%> &nbsp;&nbsp; <%=(EXIREG.Fields.Item("VERNAME").Value)%> &nbsp;&nbsp;&nbsp; 
      <% if (EXIREG.Fields.Item("VERIFIEDSTATUS").Value="VERIFIED") then %>
      <img src="images/checkbw.jpg" width="18" height="17">&nbsp;Verified 
      <% end if %>
      </font></td>
  </tr>
  <tr valign="middle"> 
    <td width="15%" bgcolor="#efefef"> 
      <div align="right" id="caption1"><font size="1"><b><%= caption1 %>&nbsp;</b></font></div>
    </td>
    <td width="2%"><font size="1"></font></td>
    <td colspan="4"> <font size="1"><%=(EXIREG.Fields.Item("APPROVEDBY").Value)%> &nbsp;&nbsp; <%=(EXIREG.Fields.Item("APPRNAME").Value)%> &nbsp;&nbsp;&nbsp; 
      <% if (EXIREG.Fields.Item("DATEAPPROVED").Value<>"") then %>
      <img src="images/checkbw.jpg" width="18" height="17">&nbsp;Approved 
      <% end if %>
      </font></td>
  </tr>
  <tr valign="middle" id="Approved2"> 
    <td width="15%" bgcolor="#efefef"> 
      <div align="right" id="caption2"><font size="1"><b><%= caption2 %>&nbsp;</b></font></div>
    </td>
    <td width="2%"><font size="1"></font></td>
    <td colspan="4"> <font size="1"><%=(EXIREG.Fields.Item("APPROVED2BY").Value)%> &nbsp;&nbsp; <%=(EXIREG.Fields.Item("APPRNAME2").Value)%> &nbsp;&nbsp;&nbsp; 
      <% if (EXIREG.Fields.Item("DATEAPPROVED2").Value<>"") then %>
      <img src="images/checkbw.jpg" width="18" height="17">&nbsp;Approved 
      <% end if %>
      </font></td>
  </tr>
  <tr valign="middle" id="Authorise"> 
    <td width="15%" bgcolor="#efefef"> 
      <div align="right"><font size="1"><b>Authorised By:</b>&nbsp;</font></div>
    </td>
    <td width="2%"><font size="1"></font></td>
    <td colspan="4"> <font size="1"><%=(EXIREG.Fields.Item("AUTHORISEDBY").Value)%> &nbsp;&nbsp; <%=(EXIREG.Fields.Item("AUTHNAME").Value)%> &nbsp;&nbsp;&nbsp; 
      <% if (EXIREG.Fields.Item("DATEAUTHORISED").Value<>"") then %>
      <img src="images/checkbw.jpg" width="18" height="17">&nbsp;Authorised 
      <% end if %>
      </font></td>
  </tr>
  <tr> 
    <td width="15%" bgcolor="#efefef"> 
      <div align="right"><font size="1"><b>Comments:&nbsp;</b></font></div>
    </td>
    <td width="2%"><font size="1"></font></td>
    <td colspan="4"> <font size="1"><%=(EXIREG.Fields.Item("COMMENTS").Value)%> </font></td>
  </tr>
  <tr> 
    <td width="15%" bgcolor="#FFFFFF">&nbsp;</td>
    <td width="2%">&nbsp;</td>
    <td colspan="4"><b><font size="1">Allocation:</font></b></td>
  </tr>
  <tr> 
    <td width="15%" bgcolor="#FFFFFF">&nbsp;</td>
    <td width="2%">&nbsp;</td>
    <td colspan="4"> 
      <table width="100%" border="0" cellspacing="1" cellpadding="3" bgcolor="#999999" id="Acct_tbl">
        <tr bgcolor="#efefef"> 
          <td width="5%"> 
            <div align="center"><font size="1"><b>No</b></font></div>
          </td>
          <td width="17%"> 
            <div align="center"><font size="1"><b>Account Code</b></font></div>
          </td>
          <td width="10%"> 
            <div align="center"><font size="1"><b>T0 </b></font></div>
          </td>
          <td width="15%"> 
            <div align="center"><font size="1"><b>T1</b></font></div>
          </td>
          <td width="12%"> 
            <div align="center"><font size="1"><b>T2</b></font></div>
          </td>
          <td width="18%"> 
            <div align="center"><font size="1"><b>T3</b></font></div>
          </td>
          <td> 
            <div align="center"><font size="1"><b>Amount (<%=(EXIREG.Fields.Item("CURRENCYSYMBOL").Value)%>)</b></font></div>
          </td>
        </tr>
        <% dim Incr 
				Incr = 1 %>
        <% 
While ((Repeat2__numRows <> 0) AND (NOT Acct.EOF)) 
%>
        <tr> 
          <td width="5%" bgcolor="#FFFFFF"> 
            <div align="center"><font size="1"><%= Incr %>.</font></div>
          </td>
          <td width="17%" bgcolor="#FFFFFF"> 
            <div align="center"> <font size="1"><%=(Acct.Fields.Item("ACCTCODE").Value)%> </font></div>
          </td>
          <td width="10%" bgcolor="#FFFFFF"> 
            <div align="center"><font size="1"><%= Acct.Fields.Item("T0CODE").Value %> </font></div>
          </td>
          <td width="15%" bgcolor="#FFFFFF"> 
            <div align="center"> <font size="1"><%=(Acct.Fields.Item("T1CODE").Value)%> </font></div>
          </td>
          <td width="12%" bgcolor="#FFFFFF"> 
            <div align="center"> <font size="1"><%=(Acct.Fields.Item("T2CODE").Value)%> </font></div>
          </td>
          <td width="18%" bgcolor="#FFFFFF"> 
            <div align="center"> <font size="1"><%=(Acct.Fields.Item("T3CODE").Value)%> </font></div>
          </td>
          <td bgcolor="#FFFFFF"> 
            <div align="center"> <font size="1"><%= FormatNumber((Acct.Fields.Item("AMOUNT").Value), -1, -2, -2, -1) %></font></div>
          </td>
        </tr>
        <% Incr = Incr + 1
  Repeat2__index=Repeat2__index+1
  Repeat2__numRows=Repeat2__numRows-1
  Acct.MoveNext()
Wend
%>
      </table>
    </td>
  </tr>
  <tr> 
    <td width="15%" bgcolor="#FFFFFF"><b><font size="1">History:</font></b></td>
    <td width="2%">&nbsp;</td>
    <td width="30%">&nbsp;</td>
    <td width="15%" bgcolor="#FFFFFF">&nbsp;</td>
    <td width="2%">&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr valign="middle"> 
    <td colspan="6"> 
      <table width="100%" border="0" cellspacing="1" cellpadding="1" bgcolor="#999999">
        <tr bgcolor="#efefef"> 
          <td width="6%"> 
            <div align="center"><font size="1"><b>No.</b></font></div>
          </td>
          <td width="15%"> 
            <div align="center"><font size="1"><b>Date</b></font></div>
          </td>
          <td> 
            <div align="center"><font size="1"><b>Description</b></font></div>
          </td>
          <td width="15%"> 
            <div align="center"><font size="1"><b>Department</b></font></div>
          </td>
          <td width="15%"> 
            <div align="center"><font size="1"><b>Update By</b></font></div>
          </td>
        </tr>
        <%  
				 Incr = 1 %>
        <% 
While ((Repeat1__numRows <> 0) AND (NOT InvHist.EOF)) 
%>
        <tr bgcolor="#FFFFFF"> 
          <td width="6%"> 
            <div align="center"><font size="1"><%= Incr %></font></div>
          </td>
          <td width="15%"> 
            <div align="center"><font size="1"><%= DoDateTime((InvHist.Fields.Item("UPDATESTAMP").Value), 2, 2070) %></font></div>
          </td>
          <td><font size="1"><%=(InvHist.Fields.Item("TRDESCR").Value)%>&nbsp;<%=(InvHist.Fields.Item("LOCNAME").Value)%></font></td>
          <td width="15%"><font size="1"><%=(InvHist.Fields.Item("DEPARTMENT").Value)%></font></td>
          <td width="15%"><font size="1"><%=(InvHist.Fields.Item("UPDATEUSER").Value)%></font></td>
        </tr>
        <% Incr = Incr + 1
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  InvHist.MoveNext()
Wend
%>
      </table>
    </td>
  </tr>
  <tr valign="middle" height="8">
    <td width="15%"></td>
    <td width="2%"></td>
    <td colspan="4"></td>
  </tr>
  <tr valign="middle"> 
    <td width="15%">&nbsp;</td>
    <td width="2%">&nbsp;</td>
    <td colspan="4" valign="middle" align="left"> <b><font size="2">Journal Voucher 
      No.:</font>&nbsp;&nbsp;</b><img src="images/kotak2.gif" width="88" height="24" align="absmiddle"></td>
  </tr>
  <tr valign="middle"> 
    <td width="15%"> 
      <input type="submit" name="Submit2" value="Print Invoice" onClick="window.print();window.close();" class="hiddenBtn">
    </td>
    <td width="2%">&nbsp;</td>
    <td colspan="4">&nbsp; </td>
  </tr>
</table>
</body>
</html>
<%
CompCode.Close()
%>
<%
EXIREG.Close()
%>
<%
InvHist.Close()
%>
<%
Acct.Close()
%>
